<template>
  <div class="home" :style="{'height':bodyHeight}">
    <div class="head">
      <div>
        <span>
          大学
          <span>OA</span>管理系统
        </span>
        <div>UNIVERSITY OA MS</div>
      </div>

      <div class="div">
        <img :src="img" alt />
        <span>
          <span>{{name}}</span>欢迎你
        </span>
        <el-button type="text" icon="el-icon-switch-button" @click="logout">退出登入</el-button>
      </div>
    </div>
    <div class="body">
      <div class="a">
        <div class="aa">
          <img :src="img" alt />
          <div class="wi">{{name}}</div>
        </div>
      </div>
      <div class="b">
        <div class="b1 c" @click="routeabout('1-1','page3')">
          <i class="el-icon-s-claim i1"></i>
          <div>智能内外勤</div>
        </div>
        <div class="b2 c" @click="routeabout('1-2','Daily')">
          <i class="el-icon-s-order i2"></i>
          <div>工作汇报</div>
        </div>
        <div class="b3 c" @click="routeabout('1-3','firstPage')">
          <i class="el-icon-user i3"></i>
          <div>客户管理</div>
        </div>
        <div class="b4 c" @click="routeabout('1-4','reimbursement')">
          <i class="el-icon-s-goods i4"></i>
          <div>财务管理</div>
        </div>
        <div class="b5 c" @click="routeabout('1-5','logistics')">
          <i class="el-icon-s-promotion i5"></i>
          <div>行政管理</div>
        </div>
        <div class="b6 c" @click="routeabout('1-6','staffManagement')">
          <i class="el-icon-user-solid i6"></i>
          <div>人员管理</div>
        </div>
        <div class="b7 c" @click="routeabout('1-7','office','office')">
          <i class="el-icon-edit i7"></i>
          <div>高校办公</div>
        </div>
        <div class="b8 c" @click="routeabout('1-8','eduzhengjiao')">
          <i class="el-icon-s-check i8"></i>
          <div>部门管理</div>
        </div>
        <div class="b9 c" @click="routeabout('1-9','myScore')">
          <i class="el-icon-medal-1 i9"></i>
          <div>学籍成绩</div>
        </div>
        <div class="b10 c" @click="routeabout('1-10','roleManage')">
          <i class="el-icon-setting i10"></i>
          <div>系统设置</div>
        </div>
      </div>
    </div>
    <div class="content">
      <div>
        <div class="left">
          <div class="div1">
            <div @click="changetitle(handle)">
              <i class="el-icon-info icon1"></i>
              <div class="text">{{handle}}</div>
              <div>{{deal}}</div>
            </div>
            <div @click="changetitle(beoff)">
              <i class="el-icon-first-aid-kit icon2"></i>
              <div class="text">{{beoff}}</div>
              <div>{{off}}</div>
            </div>
            <div @click="changetitle(relation)">
              <i class="el-icon-collection-tag icon3"></i>
              <div class="text">{{relation}}</div>
              <div>{{real}}</div>
            </div>
          </div>
          <div class="info">
            <div class="div2">最新通知</div>
            <div class="information" v-for="(item) in info" :key="item.id">
              <div class="d">
                <img :src="item.img" alt />
                <div>{{name}}</div>
              </div>
              <div class="d1">
                <div class="title">{{item.title}}</div>
                <div class="cover">{{item.content}}</div>
                <div class="date">{{item.time}}</div>
              </div>
            </div>
          </div>
        </div>
        <div class="block">
          <!-- <div> -->
          <h4>
            <i class="el-icon-info blo1" v-show="icon1"></i>
            <i class="el-icon-first-aid-kit blo2" v-show="icon2"></i>
            <i class="el-icon-collection-tag blo3" v-show="icon3"></i>
            {{title}}
          </h4>
          <div>
            <p v-show="icon1" v-for="(item) in contended" :key="item.sid + '-label'">
              <span class="only">{{item.sid}}</span>
              、{{item.contend}}
            </p>
            <p
              v-show="icon2"
              v-for="(item,index) in offevent"
              :key="index + '-labelll'"
              class="fontonly"
            >
              <span class="only">{{index + 1}}</span>、
              <span class="font1 only">{{item.username}}</span> 在
              <span class="font2 only">{{item.starttime}}</span> 因
              <span class="font3 only">{{item.reasonleave}}</span> 提出请假申请,截止时间为
              <span class="font4 only">{{item.endtime}}</span>
            </p>

            <p v-show="icon3" v-for="(item) in relationevent" :key="item.cid + '-labell'">
              <span class="only">{{item.cid}}</span>
              、{{item.contend}}
            </p>
          </div>

          <!-- </div> -->
        </div>
        <div class="right">
          <el-calendar v-model="value" class="rili"></el-calendar>
          <div class="div3">
            <div>
              <i class="el-icon-location" :style="{'color':'green'}"></i>
              当前城市：{{city}}
            </div>
            <div>
              <i class="el-icon-sunrise-1" :style="{'color':'aqua'}"></i>
              温度：{{wendu}}℃
            </div>
            <div>
              <i class="el-icon-warning-outline" :style="{'color':'red'}"></i>
              小提示：{{ganmao}}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      relationevent: [
        { contend: "大江东去浪淘尽，千古风流人物", cid: 1 },
        { contend: "人言落日是天涯，望极天涯不见家", cid: 2 },
        { contend: "落霞与孤鹜齐飞，秋水共长天一色", cid: 3 },
        { contend: "大风起兮云飞扬，力拔山兮气盖世", cid: 4 },
      ],
      icon1: true,
      icon2: false,
      icon3: false,
      title: "",
      contend: [
        {
          contend: "in dealing 处理中，有用户请假尚未处理，请立即前往处理",
          sid: 1,
        },
        { contend: "财务管理中有新的事件待处理", sid: 2 },
        { contend: "行政管理中有新的事件待处理", sid: 3 },
        { contend: "高校办公中有新的事件待处理", sid: 4 },
      ],
      contended: "",
      handle: "待处理",
      beoff: "请假人数",
      relation: "相关事宜",
      name: "世界",
      bodyHeight: window.innerHeight - 16 + "px",
      bodywidth: "2",
      value: new Date(),
      city: "",
      wendu: "",
      ganmao: "",
      img: require("../../../public/img/logo.png"),
      info: [
        {
          id: 1,
          img: require("../../../public/img/logo.png"),
          title: "上海上海",
          content: "2008年奥运会成功在北京召开，鸟巢因其巧夺天工得到举世瞩目",
          time: "2020-5-25",
        },
        {
          id: 2,
          img: require("../../../public/img/logo.png"),
          title: "成都成都",
          content: "2008年奥运会成功在北京召开，鸟巢因其巧夺天工得到举世瞩目",
          time: "2020-5-25",
        },
        {
          id: 3,
          img: require("../../../public/img/logo.png"),
          title: "天津天津",
          content: "2008年奥运会成功在北京召开，鸟巢因其巧夺天工得到举世瞩目",
          time: "2020-5-25",
        },
      ],
      deal: 4,
      off: 1,
      real: 4,
      offevent: [],
    };
  },
  methods: {
    logout() {
      let that = this;
      that
        .$axios({
          method: "post",
          url: "/api/logout",
        })
        .then((data) => {
          that.$router.push("/");
          this.$message("请重新登录!");
          sessionStorage.setItem('loginState',false)
        });
    },
    changetitle(e) {
      this.title = e;
      if (e == this.handle) {
        this.icon1 = true;
        this.icon2 = false;
        this.icon3 = false;
      } else if (e == this.beoff) {
        this.icon1 = false;
        this.icon2 = true;
        this.icon3 = false;
      } else {
        this.icon1 = false;
        this.icon2 = false;
        this.icon3 = true;
      }
    },
    routeabouttest() {
      this.$router.push("/about/roleManage");
    },
    routeabout: function (id, e) {
      console.log(e);
      this.$router.push("/about/" + e + "?id=" + id);
    },
    begin() {
      let that = this;
      let url = "/api/selectEmpLeave";
      let params = {
        empid: 5,
      };
      that
        .$axios({
          method: "post",
          url: url,
          data: JSON.stringify(params),
        })
        .then((res) => {
          console.log(res.data.data);
          this.off = res.data.data.length;
          this.offevent = res.data.data;
        });
    },
  },
  mounted() {
    window.onresize = () => {
      this.bodyHeight = window.innerHeight - 16 + "px";
    };
  },

  created() {
    this.contended = this.contend;
    this.title = this.handle;
    let that = this;
    this.$axios
      .get("http://wthrcdn.etouch.cn/weather_mini?city=成都")
      .then(function (response) {
        that.city = response.data.data.city;
        that.wendu = response.data.data.wendu;
        that.ganmao = response.data.data.ganmao;
        console.log(that.city);
        console.log(that.wendu);
        console.log(that.ganmao);
      })
      .catch(function (error) {
        // console.log(error);
      });
    this.begin();
  },
};
</script>

<style scoped lang="less">
.fontonly {
  // font-weight: 300;
  color: rgb(83, 83, 83);
}
.only {
  color: rgb(59, 58, 58);
  font-weight: 600;
}
.blo1 {
  background-color: yellowgreen;
  color: white;
}
.blo2 {
  background-color: red;
  color: white;
}
.blo3 {
  background-color: aqua;
  color: white;
}
.block {
  margin: 0 auto;
  overflow: hidden;
  margin-right: 50%;
  // transform: translateX(50%);
  // margin-left: 5%;
  transform: translateX(15%);
  // background: url("../../../public/img/index0.jpg") no-repeat;
  // background-size: contain;

  margin-top: 2%;
  // transform: translateY(9%);
  width: 24.6%;
  height: 90%;
  // border: 1px solid;
  padding-top: 0.1%;
  border-radius: 5px;
  box-shadow: 0 0 3px 2px #e3e3e3;
  // background-color: red;
  // & > div {
  //   background-color: #fff;
  //   height: 90%;
  //   width: 80%;
  //   margin: 0px auto;
  //   margin-top: 4%;
  //   border-radius: 10px;
  //   box-shadow: 0 0 3px 2px #d3d3d3;
  background-color: rgba(14, 12, 11, 0.1);
  & > h4 {
    text-align: center;
    padding: 6% 0% 3% 0%;
    // border: 1px solid;
    margin: 0px;
    text-indent: -5%;
    border-bottom: 2px solid #f3f3f3;
  }
  // &>div{
  //   overflow: hidden;
  // }
  & > div > p {
    // text-align: center;
    margin: 0px auto;
    margin-top: 3%;
    width: 90%;
    border-bottom: 1px solid #f3f3f3;
    font-size: 14px;
    // border: 1px solid;
  }
  & > p::first-line {
    text-indent: 20px;
  }
  // }
}
.home {
  background: url("../../../public/img/index.jpg") no-repeat;
  background-size: cover;
}
.rili:hover {
  transform: scale(1.5);
  position: relative;
  z-index: 200;
}
.wi {
  width: 82px;
}
.div3 {
  position: absolute;
  width: 100%;
  background-color: #fff;
  box-shadow: 0 0 3px 2px #e3e3e3;
  height: 30%;
  top: -33%;
  border-radius: 5px;
  font-size: 24px;
  display: flex;
  flex-wrap: wrap;
  // border: 1px solid red;
  align-items: center;
  & div {
    margin-left: 20px;
    width: 100%;
  }
}
.right {
  float: right;
  // height: 100px !important;
  width: 40%;
  position: absolute;
  top: 6%;
  right: -5%;
  transform: scale(0.6);
  // border: 1px solid red;
  // margin-top: 0px;
}
// .date:nth-of-type(1) {
//   color: rgb(238, 230, 230);
// }
.information {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%;
  height: 100px;
  margin: 0px auto;
  // border:1px solid red;
  border: 1px solid;
  border-color: transparent silver silver silver;
  // margin-top: 1px;
  & > .d {
    text-align: center;
    // border-radius: 10px;
    margin-left: 3%;
  }
  & .d1 {
    width: 90%;
    // border-radius: 10px;
    // height: 100px;
    margin-left: 3%;
    & > .cover {
      color: rgb(71, 70, 70);
    }
    & > .title {
      font-weight: 600;
      font-size: 16px;
      // border-bottom: 1px solid silver;
    }

    & > .date {
      font-size: 12px;
      font-weight: 200;
      color: rgb(212, 212, 212);
    }
  }
  & img {
    width: 40px;
    border-radius: 50%;
    border: 1px solid silver;
    height: 40px;
  }
}
.info {
  // border: 1px solid red;
  box-shadow: 0 0 1px 1px silver;
  margin-top: 20px;
  background-color: rgba(14, 12, 11, 0.1);
  width: 91.7%;
  margin: 0px auto;
  padding-bottom: 30px;
  overflow: hidden;
  border-radius: 5px;
  & > .div2 {
    margin: 0px auto;
    text-align: center;
    width: 95%;
    margin: 0px auto;
    margin-top: 5px;
    border-bottom: 1px solid rgb(219, 219, 219);
    padding-bottom: 5px;
    // border: 1px solid red;
  }
  // border: 1px solid red;
}
.text {
  margin-top: 15px;
}
.left {
  margin-bottom: 10px;
  float: left;
  // background-color: #fff;
  width: 40%;
  // height: 30%;
  & > .div1 {
    // border: 1px solid red;
    border-radius: 5px;
    margin-bottom: 10px;
    & > div {
      // border: 1px solid red;
      box-shadow: 0 0 3px 2px #e3e3e3;
      background-color: #fff;
      width: 25%;
      border-radius: 5px;
      height: 80px;
      position: relative;
      margin-top: 40px;
      text-align: right;
      & > div {
        font-weight: 300;
        margin-right: 20px;
      }
      & > div:nth-of-type(2) {
        font-weight: 600;
      }
    }
    display: flex;
    justify-content: space-around;
    & .icon1 {
      border-radius: 10px;
      top: -40%;
      z-index: 3;
      left: 15%;
      background-color: yellowgreen;
      box-shadow: 0 0 3px 1px #a9d06b;
      color: white;
      position: absolute;
      font-size: 60px;
    }
    & .icon2 {
      border-radius: 10px;
      top: -40%;
      z-index: 3;
      left: 15%;
      box-shadow: 0 0 3px 2px #dc5b6f;
      background-color: tomato;
      color: white;
      position: absolute;
      font-size: 60px;
    }
    & .icon3 {
      border-radius: 10px;
      top: -40%;
      z-index: 3;
      left: 15%;
      box-shadow: 0 0 3px 2px #59c3e2;
      background-color: aqua;
      color: white;
      position: absolute;
      font-size: 60px;
    }
  }
}
.content {
  position: relative;
  overflow: hidden;
  // border: 1px solid red;
  // background: url("../../../public/img/781.jpg") no-repeat;
  background-size: cover;
  width: 100%;
  height: 58%;

  & > div {
    overflow: hidden;
    width: 98%;
    margin: 0px auto;
    height: 95%;
    // background-color: rgb(236, 236, 236);
    // margin-top: 30px;
  }
}
// .b{
//   // margin-left: 3%!important;
//   // border: 1px solid;
//   margin-top: 1% !important;
//   margin: 0px auto;
// }
.b2 {
  margin-top: 40px;
}
.b3 {
  margin-top: 65px;
}
.b4 {
  margin-top: 80px;
}
.b5 {
  margin-top: 90px;
}
.b6 {
  margin-top: 90px;
}
.b7 {
  margin-top: 80px;
}
.b8 {
  margin-top: 65px;
}
.b9 {
  margin-top: 40px;
}
.b {
  display: flex;
  justify-content: space-around;
  width: 80%;
  height: 80%;
  // margin: 0px auto;
  // border: 1px solid red;
  margin-top: 1%;
  margin-left: 50%;
  transform: translateX(-48.6%);
  & > div {
    // border: 1px solid white;
    width: 7%;
    height: 50%;
    text-align: center;
    & > i:hover {
      box-shadow: 0 0 5px 3px #e61c64;
      transform: scale(1.1);
      transition: all 0.3s;
    }
    & > .i1 {
      color: green;
      border-radius: 50%;
      border: 1px solid green;
      box-shadow: 0 0 1px 1px white;
      background-color: #fff;
      box-shadow: 0 0 3px 2px green;
      font-size: 40px;
    }
    & > .i2 {
      color: blue;
      border-radius: 50%;
      border: 1px solid blue;
      box-shadow: 0 0 1px 1px white;
      background-color: #fff;
      box-shadow: 0 0 3px 2px blue;
      font-size: 40px;
    }
    & > .i3 {
      color: #f582b2;
      border-radius: 50%;
      border: 1px solid #f582b2;
      box-shadow: 0 0 1px 1px white;
      background-color: #fff;
      box-shadow: 0 0 3px 2px #f582b2;
      font-size: 40px;
    }
    & > .i4 {
      color: rgb(190, 206, 43);
      border-radius: 50%;
      border: 1px solid rgb(190, 206, 43);
      box-shadow: 0 0 1px 1px white;
      background-color: #fff;
      box-shadow: 0 0 3px 2px rgb(190, 206, 43);
      font-size: 40px;
    }
    & > .i5 {
      color: rgb(180, 72, 212);
      border-radius: 50%;
      border: 1px solid rgb(180, 72, 212);
      box-shadow: 0 0 3px 2px rgb(180, 72, 212);
      background-color: #fff;
      font-size: 40px;
    }
    & > .i6 {
      color: #ed6e3d;
      border-radius: 50%;
      border: 1px solid #ed6e3d;
      box-shadow: 0 0 3px 2px #ed6e3d;
      background-color: #fff;
      font-size: 40px;
    }
    & > .i7 {
      color: #6abd78;
      border-radius: 50%;
      border: 1px solid #6abd78;
      box-shadow: 0 0 3px 2px #6abd78;
      background-color: #fff;
      font-size: 40px;
    }
    & > .i8 {
      color: #e198c0;
      border-radius: 50%;
      border: 1px solid #e198c0;
      box-shadow: 0 0 3px 2px #e198c0;
      background-color: #fff;
      font-size: 40px;
    }
    & > .i9 {
      color: #edd433;
      border-radius: 50%;
      border: 1px solid #fff100;
      box-shadow: 0 0 3px 2px #edd433;
      background-color: #fff;
      font-size: 40px;
    }
    & > .i10 {
      color: #00225a;
      border-radius: 50%;
      border: 1px solid #00225a;
      box-shadow: 0 0 3px 2px #00225a;
      background-color: #fff;
      font-size: 40px;
    }
    & > div {
      font-size: 15px !important;
      color: #04163a;
      font-family: "楷体";
      margin-top: 6px;
      font-size: 14px;
      text-align: center;
    }
    // border-radius: 50%;
  }
}
.aa {
  & > img {
    width: 120px;
    height: 120px;
    border: 1px solid #006500;
    box-shadow: 0 0 3px 3px #a9d06b;
    border-radius: 50%;
  }
  & > div {
    // border: 1px solid black;
    width: 120px;
    text-align: center;
    // color: white;
    font-size: 26px;
    font-weight: 600;
  }
  position: absolute;
  transform: translateX(9%);
  // border: 1px solid red;
}
.a {
  width: 5%;
  // border: 1px solid red;
  // margin: 0px auto;
  // padding-top: 20px;
  position: relative;
  // border: 1px solid black;
  left: 50%;
  transform: translateX(-50%);
  height: 35%;
  top: 10%;
}
.body {
  width: 100%;
  height: 33%;
  margin-top: 1px;
  box-shadow: 0 0 3px 1px rgb(223, 222, 222);
  // background: url(../../../public/img/782.jpg) no-repeat;
  background-size: 100% 100%;
  // background-position: 0px -550px;
}
.head {
  height: 80px;
  box-shadow: 0 0 3px 1px silver;
  background-color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  // border: 1px solid black;
  & > div:nth-of-type(1) {
    margin-left: 2%;
    & > span {
      font-weight: 600;
      font-size: 26px;
      font-family: "华文行楷";
      & > span {
        font-family: "Times New Roman";
      }
    }
    & div {
      font-size: 13px;
      text-align: center;
      font-weight: 600;
      font-family: "Times New Roman";
    }
  }
}
.div {
  display: flex;
  width: 240px;
  justify-content: space-between;
  align-items: center;
  margin-right: 3%;
  & img {
    border: 1px solid silver;
    border-radius: 50%;
    width: 50px;
    height: 50px;
  }
  & > span {
    margin-left: -10%;
    font-family: "楷体";
    font-weight: 600;
    font-size: 17px;
  }
  & button {
    // border-radius: 5px;
    // height: 40px;
  }
}
</style>
